{template '_header'}

<div class="page-header">当前位置：<span class="text-primary">供应商管理</span></div>

<div class="page-content">
    <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="mx_shop" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r" value="manage.supply" />

        <div class="page-toolbar">

            <div class="col-sm-7">
                <div class="pull-left">
                    {ifp 'operator.add'}
                    <a class="btn btn-primary btn-sm" href="{php echo webUrl('manage/supply/post')}"><i class="fa fa-plus"></i> 添加供应商</a>
                    {/if}
                </div>
                <div class="btn-group btn-group-sm" style='float:left;'>
                    <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                </div>
            </div>

            <div class="col-sm-5 pull-right">
                <div class="input-group">
                    <div class="input-group-select">
                        <select name='status' class='form-control  input-sm select-md' style="width:120px;"  >
                            <option value="0" {if $_GPC['status']=='0'}selected{/if}>选择状态</option>
                            <option value="1" {if $_GPC['status']=='1'}selected{/if}>启用</option>
                            <option value="2" {if $_GPC['status']=='2'}selected{/if}>禁用</option>
                        </select>
                    </div>
                    <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                    <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                </span>
                </div>
            </div>
        </div>
    </form>

    {if count($list)>0}

    <table class="table table-hover table-responsive" style="font-size: 12px">
        <thead class="navbar-inner">
        <tr>
            <th style='width:80px;'>供应商</th>
            <th style='width:80px;'>头像</th>
            <th style='width:80px;'>设备数</th>
            <th style='width:80px;'>累计佣金</th>
            <th style='width:80px;'>状态</th>
            <th style='width:80px;'>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $row}
        <tr>
            <td >
            <span>{$row['nickname']}</span>
            </td>

            <td >
                <img src="{php echo tomedia($row['thumb'])}" style="width:50px;height:50px;">
            </td>

            <td >
                <span><a {ifp 'sgoods.main'}href="{php echo webUrl('sgoods', array('supplyid'=>$row['id']))}"{/if}>{$row['goods']} </a></span>
            </td>

            <td >
                {ifp 'sorder.commission.commlog'}
                    {if !empty($row['comid'])}
                    <span><a href="{php echo webUrl('sorder/commission/commlog', array('id'=>$row['comid']))}">{$row['comm']} 元</a></span>
                    {else}
                    <span>{$row['comm']} 元</span>
                    {/if}
                {else}
                    <span>{$row['comm']} 元</span>
                {/if}
            </td>

            <td>
                <span class='label {if $row['status']==1}label-success{else}label-default{/if}'
                {ifp 'manage.supply.edit'}
                data-toggle='ajaxSwitch'
                data-switch-value='{$row['status']}'
                data-switch-value0='0|禁用|label label-default|{php echo webUrl('manage/supply/status',array('status'=>1,'id'=>$row['id']))}'
                data-switch-value1='1|启用|label label-success|{php echo webUrl('manage/supply/status',array('status'=>0,'id'=>$row['id']))}'
                {/if}
                >
                {if $row['status']==1}启用{else}禁用{/if}</span>
            </td>

            <td style="overflow:visible;">
                {ifp 'manage.supply.edit'}
                <a href="{php echo webUrl('manage/supply/post',array('id' => $row['id']))}" title="编辑"><i class='fa fa-edit'></i> 编辑</a>
                {/if}

                {ifp 'manage.supply.delete'}
                &nbsp; &nbsp;<a href="{php echo webUrl('manage/supply/delete',array('id' => $row['id']))}" data-toggle='ajaxRemove'  data-confirm="确认要删除该供应商吗?" title="删除">
                    <i class='fa fa-trash'></i> 删除
                </a>
                {/if}

                {ifp 'sgoods.main'}
                &nbsp; &nbsp;<a href="{php echo webUrl('sgoods',array('supplyid'=>$row['id']))}" title='设备列表'><i class='fa fa-list'></i> 设备</a>
                {/if}

                {ifp 'sorder.commission.commlog'}
                {if !empty($row['comid'])}
                &nbsp; &nbsp;<a href="{php echo webUrl('sorder/commission/commlog', array('id'=>$row['id']))}" title='佣金明细'><i class='fa fa-money'></i> 佣金</a>
                {/if}
                {/if}
            </td>
        </tr>
        {/loop}
        </tbody>
    </table>
    {$pager}

    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">未查询到相关数据</div>
    </div>
    {/if}
</div>

{template '_footer'}